package com.itheima.test;

public class test5 {
    public static void main(String[] args) {
        //给两个以字符串形式表示的非负整数，返回乘积，表示为字符串

        //不需要考虑乘积过大

        String str1 = "123456";
        String str2 = "12245";

        //1.把字符串变成整数
        //先遍历字符串得到每一个字符
        //字符变成对应数字
        int num1 = 0;
        int num2 = 0;
        for (int i = 0; i < str1.length(); i++) {
            int num = str1.charAt(i);
            num1 = num1*10+num;
        }
        for (int i = 0; i < str2.length(); i++) {
            int num = str2.charAt(i);
            num2 = num2*10+num;
        }

        //2.整数相乘
        int result = num1*num2;

        //3.变成字符串
        String resultStr = new String(""+result);
        System.out.println(resultStr);

    }
}
